#ARGV 0:	directory of log files
#ARGV 1:	number of considered rounds

 
$dir = $ARGV[0];

$start = 1;
$recordNum = 1001;
$round = 2567;
if($ARGV[1]!=0){
	$round = $ARGV[1];
}

$fileName = "$ARGV[0]\\totalSync.info";
open fout, ">$fileName" or die "can not open file >$fileName!\n";
for($i=0;$i<$round;$i++){
	$start = $i*($recordNum+2)+1;
	
	$cmd = "perl proLogWithSyncTimeStampBySelfDefinedInterval.pl ".$dir." ".$recordNum." ".$start;
	print "$i Round $cmd\n";
	system("$cmd\n");
	
	$file_path = "$ARGV[0]\\temp\\totalSync".$start.".info";
	open fin, "<$file_path" or die "can not open file $file_path!\n";
	while(<fin>){
		print fout $_; 
	}
	close fin;
	
	$cmd = "del ".$file_path;
	system("$cmd\n");
}
close fout;
	